package com.fengye.algorithms.huawei;

import java.util.Scanner;

/**
 * https://www.nowcoder.com/practice/a35ce98431874e3a820dbe4b2d0508b1?tpId=37&tqId=21225&rp=1&ru=/exam/oj/ta&qru=/exam/oj/ta&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D37&difficulty=undefined&judgeStatus=undefined&tags=&title=
 * @Author fengye
 * @Date 2023/4/7 10:11
 **/
public class StrAppearNumberMain {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        String str[] = new String[2];
        int i = 0;
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String temp = in.nextLine();
            i = i%2;
            str[i] = temp.toUpperCase();
            if (i == 1 ) {
                String doStr = str[0];
                String chr = str[1];

                char[] tChr = doStr.toCharArray();
                int num = 0;
                for (int j = 0; j < doStr.length(); j++) {
                    if (tChr[j] == chr.charAt(0)) {
                        num++;
                    }
                }
                System.out.println(num);
            }
            i++;
        }
    }
}
